package com.qf.mapper;

import com.qf.dto.DeveloperDto;
import com.qf.model.Developer;
import org.apache.ibatis.annotations.*;
import java.util.List;

@Mapper
public interface DeveloperMapper  {
    @Select("select * from developer where did =#{did} and status=1")
    Developer findByDid(String did);

    @Select("select * from developer where did =#{did} and status=1")
    DeveloperDto findByDidDto(String did);

    @Select("Select * from project where status =1")
    List<Developer> findAll();

    //分页查询  limit  0,10  currentPage当前页  pageSize每页大小
    @Select("Select * from developer where status =1 limit #{currentPage},#{pageSize}")
    List<Developer> findPage(@Param("currentPage")Integer currentPage, @Param("pageSize") Integer pageSize);

    // 查询总记录数
    @Select("select count(*) from developer where status=1")
    Long count();

    @Insert("insert into developer (did,dname,updatetime) values (#{did},#{dname},#{updatetime})")
    int add(Developer developer);

    @Update("update developer set dname=#{dname},updatetime=#{updatetime} where did =#{did}")
    int edit(DeveloperDto developerDto);


    @Update("update developer set status=0 where did=#{did}")
    int delByDid(String did);

}
